package model

import (
	"food-mgr/food-service/configs"
	"gorm.io/gorm"
)

type Biz struct {
	gorm.Model
	Name    string  `gorm:"type:varchar(30);comment:商家名称"`
	Address string  `gorm:"type:varchar(30);comment:商家地址"`
	Status  string  `gorm:"type:varchar(30);comment:商家在线状态"`
	Score   float64 `gorm:"type:decimal(10,2);comment:评分"`
}

func FindBiz(b *Biz, id int) {

	configs.DB.Where("id=?", id).First(&b)
}
func ListBiz(b *[]Biz, name string) error {

	return configs.DB.Where("name like ?", "%"+name+"%").Order("score DESC").Find(&b).Error
}
